28#include "yaml-schema-cpp/yaml_server.hpp"
48#define WOLF_LANDMARK_CREATE(LandmarkClass) \
49 static LandmarkBasePtr create(const YAML::Node& _node, const std::vector<std::string>& _folders_schema = {}) \
51 if (not _folders_schema.empty()) \
53 auto server = yaml_schema_cpp::YamlServer(_folders_schema); \
54 server.setYaml(_node); \
55 if (not server.applySchema(#LandmarkClass)) \
57 WOLF_ERROR(server.getLog()); \
60 std::shared_ptr<LandmarkClass> lmk(new LandmarkClass(server.getNode())); \
61 lmk->emplacePriors(); \
64 std::shared_ptr<LandmarkClass> lmk(new LandmarkClass(_node)); \
65 lmk->emplacePriors(); \
69#define WOLF_LANDMARK_TEMPLATE_DIM_CREATE(LandmarkClass, Dim) \
70 static LandmarkBasePtr create(const YAML::Node& _node, const std::vector<std::string>& _folders_schema = {}) \
72 if (not _folders_schema.empty()) \
74 auto server = yaml_schema_cpp::YamlServer(_folders_schema); \
75 server.setYaml(_node); \
76 if (not server.applySchema(#LandmarkClass + std::to_string(Dim) + "d")) \
78 WOLF_ERROR(server.getLog()); \
81 std::shared_ptr<LandmarkClass<Dim>> lmk(new LandmarkClass<Dim>(server.getNode())); \
82 lmk->emplacePriors(); \
85 std::shared_ptr<LandmarkClass<Dim>> lmk(new LandmarkClass<Dim>(_node)); \
86 lmk->emplacePriors(); \
98 static unsigned int landmark_id_count_;
108 void setProblem(ProblemPtr _problem)
override;
128 const int _external_id = -1,
129 const int _external_type = -1);
142 void remove(
bool viral_remove_parent_without_children =
false)
override;
144 YAML::Node
toYaml()
const override;
147 unsigned int id()
const override;
151 void setId(
unsigned int _id);
179 MapBaseConstPtr
getMap()
const;
187 void link(MapBasePtr);
191 template <
typename classType,
typename... T>
192 static std::shared_ptr<classType>
emplace(MapBasePtr _map_ptr, T&&... all);
200 std::ostream& stream,
201 std::string _tabs =
"")
const;
205 virtual void print(
int depth,
209 std::ostream& stream = std::cout,
210 std::string _tabs =
"")
const;
214 virtual CheckLog localCheck(
bool _verbose, std::ostream& _stream, std::string _tabs =
"")
const;
218 virtual bool check(
CheckLog& _log,
bool _verbose, std::ostream& _stream, std::string _tabs =
"")
const;
223 void setMap(
const MapBasePtr _map_ptr);
242template <
typename classType,
typename... T>
245 std::shared_ptr<classType> lmk = std::make_shared<classType>(std::forward<T>(all)...);
246 lmk->emplacePriors();
253 return map_ptr_.lock();
258 return map_ptr_.lock();
261inline void LandmarkBase::setMap(
const MapBasePtr _map_ptr)
274 if (_id > landmark_id_count_) landmark_id_count_ = _id;
309 return std::static_pointer_cast<LandmarkBase>(shared_from_this());
314 return std::static_pointer_cast<const LandmarkBase>(shared_from_this());
Log of a consistency check: whether it is consistent and the explanation of the inconsistencies.
Definition: check_log.h:30
Base class of factors: a constraint between state blocks of one or more nodes, given a measurement an...
Definition: factor_base.h:73
Base class of landmarks: elements of the map with state blocks, observed from the frames.
Definition: landmark_base.h:93
void setProblem(ProblemPtr _problem) override
Sets the problem (if not set yet) and notifies it of all the state blocks and prior factors.
Definition: landmark_base.cpp:107
int getExternalId() const
Returns the id provided by an external tracker (-1 untracked)
Definition: landmark_base.h:292
unsigned int track_id_
Associated track id.
Definition: landmark_base.h:102
int external_type_
Type provided by an external classifier (-1 unclassified)
Definition: landmark_base.h:104
int external_id_
Id provided by an external tracker (-1 untracked)
Definition: landmark_base.h:103
void setTrackId(unsigned int _track_id)
Sets the associated track id.
Definition: landmark_base.h:282
unsigned int id() const override
Returns the id of the node, unique among the nodes of its category.
Definition: landmark_base.h:266
LandmarkBase(const std::string &_type, const TypeComposite &_state_types, const VectorComposite &_state_vectors, const PriorComposite &_state_priors, const int _external_id=-1, const int _external_type=-1)
Constructor from the type and the state specs composites (types, vectors, priors)
Definition: landmark_base.cpp:28
virtual void print(int depth, bool factored_by, bool metric, bool state_blocks, std::ostream &stream=std::cout, std::string _tabs="") const
Prints this node and, depending on the depth, its children.
Definition: landmark_base.cpp:133
MapBaseConstPtr getMap() const
Returns the map the landmark belongs to.
Definition: landmark_base.h:251
int getExternalType() const
Returns the type provided by an external classifier (-1 unclassified)
Definition: landmark_base.h:302
unsigned int landmark_id_
Landmark id, unique among landmarks.
Definition: landmark_base.h:101
YAML::Node toYaml() const override
Returns a YAML node with the type, the states and their priors.
Definition: landmark_base.cpp:77
virtual void printHeader(int depth, bool factored_by, bool metric, bool state_blocks, std::ostream &stream, std::string _tabs="") const
Prints the information of this node (not of its children)
Definition: landmark_base.cpp:114
void setExternalType(const int &_external_type)
Sets the type provided by an external classifier.
Definition: landmark_base.h:297
void remove(bool viral_remove_parent_without_children=false) override
Removes the node: its state blocks and the factors constraining them.
Definition: landmark_base.cpp:57
LandmarkBasePtr shared_from_this_landmark()
Returns a shared pointer to this landmark.
Definition: landmark_base.h:307
virtual bool check(CheckLog &_log, bool _verbose, std::ostream &_stream, std::string _tabs="") const
Checks the consistency of this node and its children, composing the log.
Definition: landmark_base.cpp:174
virtual CheckLog localCheck(bool _verbose, std::ostream &_stream, std::string _tabs="") const
Checks the consistency of this node (not of its children)
Definition: landmark_base.cpp:143
TimeStamp stamp_
Time stamp of the creation of the landmark (unused)
Definition: landmark_base.h:105
void link(MapBasePtr)
Links the landmark to a map.
Definition: landmark_base.cpp:90
void setId(unsigned int _id)
Sets the landmark id, updating the counter to avoid repeated ids.
Definition: landmark_base.h:271
~LandmarkBase() override=default
unsigned int trackId()
Returns the associated track id.
Definition: landmark_base.h:277
void setExternalId(const int &_external_id)
Sets the id provided by an external tracker.
Definition: landmark_base.h:287
static std::shared_ptr< classType > emplace(MapBasePtr _map_ptr, T &&... all)
Creates a landmark of class classType, emplaces its priors and links it to the map.
Definition: landmark_base.h:243
Base class of the nodes having state blocks (sensors, frames, captures and landmarks)
Definition: node_state_blocks.h:36
TimeStamp implements basic functionalities for time stamps.
Definition: time_stamp.h:39
Composite of state vectors.
Definition: vector_composite.h:29
Definition: capture_base.h:23